package weather.app.pack;


import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class ActivityTwo extends Activity 
{
	
	public void onCreate(Bundle savedInstanceState) 
	{

        super.onCreate(savedInstanceState);
        
        //List items
        final CharSequence[] items = {
        		"Bucuresti",
        		"Iasi",
        		"Cluj-Napoca",
        		"Timisoara",
        		"Craiova",
        		"Constanta",
        		"Galati",
        		"Brasov",
        		"Ploiesti",
        		"Braila",
        		"Oradea",
        		"Bacau",
        		"Arad",
        		"Pitesti",
        		"Sibiu",
        		"Targu-Mures",
        		"Baia Mare",
        		"Buzau",
        		"Botosani",
        		"Satu Mare"};

        //Prepare the list dialog box
        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        //Set its title
        builder.setTitle("Pick a city");

        final Intent raspuns = new Intent ();
        
        builder.setItems(items, new DialogInterface.OnClickListener() 
        {

        	// Click listener

        	public void onClick(DialogInterface dialog, int item) 
        	{
        		Toast.makeText(getApplicationContext(), items[item]+" was picked", Toast.LENGTH_SHORT).show();
            
        		// setam parametrii
        		raspuns.putExtra ("name", items[item]);
           
        		setResult (1, raspuns);
           
        		finish();
        	}

        });// end OnClickListener

        AlertDialog alert = builder.create();

        //display dialog box

        alert.show();
        

	}// end onCreate
	
	
	public void onClick(View view) {
		finish();
	}
	
}// end ActivityTwo
